import { createRouter, createWebHistory } from 'vue-router'
import Layout from '@/layout/index.vue'

const routes = [
  {
    path: '/',
    component: Layout,
    redirect: '/supplier',
    children: [
      {
        path: '/supplier',
        name: 'Supplier',
        component: () => import('@/views/supplier/index.vue'),
        meta: { title: '供应商管理', icon: '🏢' }
      },
      {
        path: '/customer',
        name: 'Customer',
        component: () => import('@/views/customer/index.vue'),
        meta: { title: '客户管理', icon: '👥' }
      },
      {
        path: '/employee',
        name: 'Employee',
        component: () => import('@/views/employee/index.vue'),
        meta: { title: '员工管理', icon: '👨‍💼' }
      },
      {
        path: '/order',
        name: 'Order',
        meta: { title: '订单与报价管理', icon: '📋' },
        children: [
          {
            path: '/order/quote',
            name: 'Quote',
            component: () => import('@/views/order/quote/index.vue'),
            meta: { title: '报价单', icon: '📄' }
          },
          {
            path: '/order/quote/edit/:id',
            name: 'QuoteEdit',
            component: () => import('@/views/order/quote/index.vue'),
            meta: { title: '编辑报价单', icon: '📄' }
          },
          {
            path: '/order/quote/view/:id',
            name: 'QuoteView',
            component: () => import('@/views/order/quote/index.vue'),
            meta: { title: '查看报价单', icon: '📄' }
          },
          {
            path: '/order/quote-record',
            name: 'QuoteRecord',
            component: () => import('@/views/order/quote-record/index.vue'),
            meta: { title: '报价记录', icon: '📝' }
          },
          {
            path: '/order/contract',
            name: 'Contract',
            component: () => import('@/views/order/contract-review/index.vue'),
            meta: { title: '合同审核', icon: '📋' }
          },
          {
            path: '/order/outsource',
            name: 'Outsource',
            component: () => import('@/views/order/outsource/index.vue'),
            meta: { title: '外发加工', icon: '🔄' }
          }
        ]
      },
      {
        path: '/warehouse',
        name: 'Warehouse',
        meta: { title: '仓库管理', icon: '📦' },
        children: [
          {
            path: '/warehouse/inbound',
            name: 'Inbound',
            component: () => import('@/views/warehouse/inbound/index.vue'),
            meta: { title: '入库', icon: '⬇️' }
          },
          {
            path: '/warehouse/inbound-record',
            name: 'InboundRecord',
            component: () => import('@/views/warehouse/inbound-record/index.vue'),
            meta: { title: '入库记录', icon: '📊' }
          },
          {
            path: '/warehouse/outbound',
            name: 'Outbound',
            component: () => import('@/views/warehouse/outbound/index.vue'),
            meta: { title: '出库', icon: '⬆️' }
          },
          {
            path: '/warehouse/outbound-record',
            name: 'OutboundRecord',
            component: () => import('@/views/warehouse/outbound-record/index.vue'),
            meta: { title: '出库记录', icon: '📈' }
          }
        ]
      }
    ]
  }
]

const router = createRouter({
  history: createWebHistory(),
  routes
})

export default router 